<style type="text/css">
	.error{
		color:red;
	}
</style>
<script type="text/javascript">
$(function(){
	$("#tipDialog").dialog({
		autoOpen:false,
		modal:true,
		width:300,
		show:"slide",
		buttons:{
			"Close":function(){
				$(this).dialog("close");
			}
		}
	});
});
	
function submitRegForm(type){
	var customerEmail = '';
	var password = ''; 
	var rePassword = '';
		customerEmail = $('[name=customerEmail]').val();
		password = $('[name=password]',"#registerForm").val();
		rePassword = $('[name=rePassword]').val();
	$.ajax({
		type:'POST',
		async:false,
		url:'/merchant/index/register',
		dataType:'json',
		data:{'customerEmail':customerEmail,'password':password,
			'rePassword':rePassword
		},
		success:function(json){
			if(json.ask){
				location.href="/merchant/my-account/index";
			}else {
				var html = "";
				$.each(json.error,function(k,v){
					html += v+"<br/>";
				});
					$("[name=customerEmail]").val(json.row.customer_email);
					$("[name=password]","#registerForm").val(json.row.customer_password);
					$("[name=rePassword]").val(json.row.rePassword);					
					$(".error").html(html);
			}
		}
	});
	return false;
}
</script>


